package com.funtl.framework.java.web.orm.hibernate.dao;

import java.util.List;

import com.funtl.framework.java.ssh.abstracts.AbstractEntity;
import com.funtl.framework.java.util.exception.ServiceException;

/**
 * 通用数据库操作
 * @author lusifer
 *
 */
public interface ICommonDBService {
	public<T extends AbstractEntity> String insert(T entity) throws ServiceException;
	public<T extends AbstractEntity> String delete(T entity) throws ServiceException;
	public<T extends AbstractEntity> String update(T entity, String id) throws ServiceException;
	public<T extends AbstractEntity> String insertOrUpdate(List<T> list) throws ServiceException;
	public<T extends AbstractEntity> long getCount(T entity) throws ServiceException;
	public<T extends AbstractEntity> T getEntity(T entity, String id) throws ServiceException;
	public<T extends AbstractEntity> T getEntityByCatch(T entity, String id) throws ServiceException;
	public<T extends AbstractEntity> List<T> getList(T entity) throws ServiceException;
	public<T extends AbstractEntity> List<T> getList(T entity, String sort, String order) throws ServiceException;
	public<T extends AbstractEntity> List<T> paging(T entity) throws ServiceException;
	public<T extends AbstractEntity> List<T> paging(T entity, String sort, String order) throws ServiceException;
	public<T extends AbstractEntity> List<T> getListByCatch(T entity) throws ServiceException;
	public<T extends AbstractEntity> List<T> getListByCatch(T entity, String sort, String order) throws ServiceException;
	public<T extends AbstractEntity> List<T> pagingByCatch(T entity) throws ServiceException;
	public<T extends AbstractEntity> List<T> pagingByCatch(T entity, String sort, String order) throws ServiceException;
}
